package com.tr.rentcar.model.dao;

import java.sql.SQLException;
import java.util.Date;
import java.util.List;
import java.util.Map;

import com.tr.rentcar.model.GlobalParamHandler;
import com.tr.rentcar.model.bean.FeedBackStyle;
import com.tr.rentcar.model.jdbc.MySqlDb;
import com.tr.rentcar.model.jdbc.ResultHandler;

public class FeedbackStyleDao implements ResultHandler<FeedBackStyle>{
	private MySqlDb db= MySqlDb.getInstance();
	/**
	 * 获取反馈类型
	 */
	public List<FeedBackStyle> findStyle() throws SQLException {
		String sql = "select * from  back_style";
		return db.executeQuery(sql,this);
	}
	/**
	 * 通过姓名获取反馈类型信息
	 */
	public FeedBackStyle findStyleId(String name) throws SQLException {
		String sql = "select * from  back_style where bs_name=?";
		return db.queryUninResult(sql,new GlobalParamHandler(name),this);
	}
	@Override
	public FeedBackStyle doHander(Map<String, Object> row) {
		FeedBackStyle fbs=new FeedBackStyle();
		Integer bsid=Integer.parseInt(row.get("bs_id")+"") ;
		fbs.setBsId(bsid);
		String bsname=row.get("bs_name")+"";
		fbs.setBsName(bsname);
		return fbs;
	}
	
}
